package org.example.huweb.web.sys_bokAi.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ai")
@RequiredArgsConstructor
public class AiController {

    private final OllamaChatModel ollamaChatModel;

    @RequestMapping("/demo")
    public String demo() {
        return "hello OllAma";
    }

    @RequestMapping( "/ollama")
    public Object ollama(String msg) {
        String called = ollamaChatModel.call(msg);
        System.out.println(called);
        return called;
    }
}
